using System;
using System.Collections.Generic;
using System.Text;

namespace Pechovic.CommandLine {
    public class ConsoleHelper {

        public static bool IsHelpRequest(string[] args) {
            if (args.Length == 0)
                return false;
            if (args[0] == "?" || args[0] == "/?" || args[0] == "-?" ||
               args[0] == "help" || args[0] == "/help" || args[0] == "-help") {
                return true;
            }
            return false;
        }

        public static void PrintHelp(string help) {
            Output.WriteYellowLine(help);
        }

        public static void HandleDebugMode(ref string[] args) {
            if (args.Length > 0) {
                if (args[args.Length - 1] == "debug") {
                    Console.Out.WriteLine("Debug mode! Connect to me and press enter.");
                    Console.ReadLine();
                    string[] newArgs = new string[args.Length - 1];
                    for (int i = 0; i < newArgs.Length; i++)
                        newArgs[i] = args[i];
                    args = newArgs;
                }
            }
        }

        public static void WriteExceptionText(string value) {
            Output.Red();
            Console.Error.WriteLine("-------------------- Exception START --------------------");
            Console.Error.WriteLine(value);
            Console.Error.WriteLine("-------------------- Exception END --------------------");
            Output.Reset();
        }

    }
}
